package operation;

/**
 * Creared with IntelliJ IDEA.
 * Description:
 * User:yxd
 * Date:2022-01-05
 * Time:2:10
 */
import book.Book;
import book.BookList;

public class FindOperation implements IOperation{
    @Override
    public void work(BookList bookList) {
        System.out.println("查找图书");
        String name = input.nextLine();
        int size = bookList.getUsedSize();
        for (int i = 0; i < size; i++) {
            Book book = bookList.getBook(i);
            if(name.equals(book.getName())){
                System.out.println("找到此书，信息如下：");
                System.out.println(book);
                return;
            }
        }
        System.out.println("未找到此书");
    }
}
